/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50736
 Source Host           : 127.0.0.1:3306
 Source Schema         : ec-cloud

 Target Server Type    : MySQL
 Target Server Version : 50736
 File Encoding         : 65001

 Date: 10/05/2022 21:25:53
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ec_system_dept
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_dept`;
CREATE TABLE `ec_system_dept` (
  `dept_id` bigint(64) unsigned NOT NULL COMMENT '部门ID',
  `tenant_id` bigint(64) NOT NULL COMMENT '所属租户ID',
  `dept_name` varchar(50) NOT NULL COMMENT '部门名称',
  `dept_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '部门描述',
  `dept_sort` int(11) DEFAULT '0' COMMENT '部门排序',
  `parent_id` bigint(64) NOT NULL DEFAULT '0' COMMENT '树形结构，父节点id',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`dept_id`),
  KEY `tenant_del_dept_idx` (`tenant_id`,`is_delete`,`dept_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门表';

-- ----------------------------
-- Records of ec_system_dept
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_dept` VALUES (1442414898812084225, 1442414898631729154, 'Ec Cloud Saas平台', 'Ec Cloud Saas平台', 3, 0, 0, '2021-06-13 16:13:50', '2021-11-26 17:28:30', 'EC888888', 'EC888888');
INSERT INTO `ec_system_dept` VALUES (1442429609511301122, 1442414898631729154, 'Ec Cloud Saas平台', 'Ec Cloud Saas平台', 0, 1442414898812084225, 0, '2021-06-13 16:13:50', '2021-11-28 19:47:25', 'EC888888', 'EC888888');
COMMIT;

-- ----------------------------
-- Table structure for ec_system_log
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_log`;
CREATE TABLE `ec_system_log` (
  `log_id` bigint(64) NOT NULL COMMENT '日志ID',
  `tenant_id` bigint(64) NOT NULL COMMENT '租户ID',
  `title` varchar(255) DEFAULT '' COMMENT '日志标题',
  `service_name` varchar(50) DEFAULT NULL COMMENT '服务ID',
  `handle_ip` varchar(255) DEFAULT NULL COMMENT '操作人IP地址',
  `req_url` varchar(255) DEFAULT NULL COMMENT '请求URI',
  `req_method` varchar(10) DEFAULT NULL COMMENT '请求方式',
  `req_params` text COMMENT '操作提交的入参',
  `exe_time` int(11) DEFAULT NULL COMMENT '执行时间(毫秒)',
  `result_msg` text COMMENT '结果信息',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_by` varchar(50) DEFAULT NULL COMMENT '操作人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='后台系统操作日志表';

-- ----------------------------
-- Table structure for ec_system_menu
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_menu`;
CREATE TABLE `ec_system_menu` (
  `menu_id` bigint(64) NOT NULL COMMENT '菜单ID',
  `parent_id` bigint(64) NOT NULL DEFAULT '0' COMMENT '父菜单ID',
  `name` varchar(32) NOT NULL COMMENT '菜单|按钮名称',
  `code` varchar(50) DEFAULT NULL COMMENT '编码',
  `alias` varchar(50) DEFAULT NULL COMMENT '别名',
  `path` varchar(128) DEFAULT NULL COMMENT '前端URL',
  `icon` varchar(32) DEFAULT NULL COMMENT '图标',
  `component` varchar(128) DEFAULT NULL COMMENT 'VUE页面',
  `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序值',
  `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '菜单类型:0-菜单，1-按钮',
  `open_flag` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否新窗口打开:0-不是，1-是',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`menu_id`),
  UNIQUE KEY `code_path` (`code`,`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='菜单权限表';

-- ----------------------------
-- Records of ec_system_menu
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_menu` VALUES (1437695137926684674, 0, '系统管理', 'sys_system_manage', 'menu', '/system', 'el-icon-setting', NULL, 1000000, 0, 0, 0, '2021-08-07 15:42:40', '2022-05-08 11:10:48', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1437696509359235073, 1437695137926684674, '用户管理', 'sys_user_manage', 'menu', '/system/user', 'el-icon-user-solid', NULL, 999993, 0, 0, 0, '2021-08-07 15:45:10', '2021-11-26 17:41:07', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1437698974959869953, 1437696509359235073, '查看', 'sys_user_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-08-07 15:46:57', '2021-11-26 17:40:54', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1438021853006004225, 1437696509359235073, '删除', 'sys_user_delete', 'delete', '', '', NULL, 1, 1, 0, 0, '2021-08-07 15:47:41', '2021-11-26 17:40:49', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1438055567887011842, 1437696509359235073, '添加', 'sys_user_add', 'add', '', '', NULL, 3, 1, 0, 0, '2021-08-07 18:15:39', '2021-11-26 17:40:46', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1442429609519689729, 1442702605840887809, '查看', 'sys_menu_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-08-08 11:53:55', '2021-11-26 17:40:33', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1442429609800708097, 1437696509359235073, '编辑', 'sys_user_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2021-08-07 18:18:10', '2021-11-26 17:40:42', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1442702604997832705, 1442702605840887809, '删除', 'sys_menu_delete', 'delete', NULL, NULL, NULL, 2, 1, 0, 0, '2021-08-08 11:55:17', '2021-11-26 17:40:29', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1442702605840887809, 1437695137926684674, '菜单管理', 'sys_menu_manage', 'menu', '/system/menu', 'el-icon-menu', NULL, 999999, 0, 0, 0, '2021-08-08 11:52:10', '2021-11-26 17:44:01', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1443484962904367106, 1437695137926684674, '角色管理', 'sys_role_manage', 'menu', '/system/role', 'el-icon-user', '', 999995, 0, 0, 0, '2021-09-30 15:56:48', '2021-11-26 17:38:43', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1443771116924960769, 1437695137926684674, '租户管理', 'sys_tenant_manage', 'menu', '/system/tenant', 'el-icon-s-custom', '', 999997, 0, 0, 0, '2021-10-01 10:53:53', '2021-11-26 17:38:44', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1444119091446562817, 1442702605840887809, '添加', 'sys_menu_add', 'add', NULL, NULL, NULL, 3, 1, 0, 0, '2021-08-08 11:56:54', '2021-11-26 17:40:25', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1444120246532718595, 1442702605840887809, '编辑', 'sys_menu_edit', 'edit', '', '', NULL, 1, 1, 0, 0, '2021-08-08 11:58:31', '2021-11-26 17:40:21', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1444133692150136834, 1437695137926684674, '部门管理', 'sys_dept_manage', 'menu', '/system/dept', 'el-icon-set-up', '', 999996, 0, 0, 0, '2021-09-30 22:10:32', '2021-11-26 17:40:15', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1449236520891928577, 1437695137926684674, '岗位管理', 'sys_post_manage', 'menu', '/system/post', 'el-icon-postcard', '', 999994, 0, 0, 0, '2021-10-16 12:51:27', '2021-11-26 17:38:45', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1454301889629257730, 1437695137926684674, '顶部菜单', 'sys_top_menu_manage', 'menu', '/system/topMenu', 'el-icon-news', '', 999998, 0, 1, 0, '2021-10-30 12:19:25', '2021-11-26 17:38:53', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1458030738464677889, 0, '监控管理', 'sys_monitor_manage', 'menu', '/monitor', 'el-icon-s-data', NULL, 0, 0, 0, 0, '2021-11-09 19:16:32', '2021-11-25 21:34:52', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1458031183908151297, 1458030738464677889, '系统日志', 'sys_log_manage', 'menu', '/system/log', 'el-icon-monitor', NULL, 0, 0, 0, 0, '2021-11-09 19:18:18', '2021-11-21 16:06:38', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459864232203497474, 1443771116924960769, '添加', 'sys_tenant_add', 'add', '', '', NULL, 3, 1, 0, 0, '2021-11-14 20:42:11', '2021-11-14 20:46:13', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459864504149585922, 1443771116924960769, '删除', 'sys_tenant_delete', 'delete', '', '', NULL, 1, 1, 0, 0, '2021-11-14 20:43:15', '2021-11-14 20:46:28', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459864696802357250, 1443771116924960769, '编辑', 'sys_tenant_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2021-11-14 20:44:01', '2021-11-14 20:46:23', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459865217164488706, 1443771116924960769, '查看', 'sys_tenant_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-11-14 20:46:05', '2021-11-14 20:46:05', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459866979745247234, 1443771116924960769, '配置租户权限', 'sys_tenant_config_per', 'config', '', '', NULL, 0, 1, 0, 0, '2021-11-14 20:53:06', '2021-11-14 20:53:06', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459868347348398082, 1444133692150136834, '查看', 'sys_dept_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-11-14 20:58:32', '2021-11-26 17:39:33', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459868748189642754, 1444133692150136834, '添加', 'sys_dept_add', 'add', '', '', NULL, 3, 1, 0, 0, '2021-11-14 21:00:07', '2021-11-26 17:39:34', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459868918230921217, 1444133692150136834, '删除', 'sys_dept_delete', 'delete', '', '', NULL, 1, 1, 0, 0, '2021-11-14 21:00:48', '2021-11-26 17:39:36', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459869191464660994, 1444133692150136834, '编辑', 'sys_dept_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2021-11-14 21:01:53', '2021-11-26 17:39:37', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459869624430080001, 1443484962904367106, '查看', 'sys_role_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-11-14 21:03:36', '2021-11-19 17:31:53', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459869734446673922, 1443484962904367106, '添加', 'sys_role_add', 'add', '', '', NULL, 3, 1, 0, 0, '2021-11-14 21:04:02', '2021-11-14 21:04:02', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459869888272773121, 1443484962904367106, '编辑', 'sys_role_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2021-11-14 21:04:39', '2021-11-14 21:04:39', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459869986729865217, 1443484962904367106, '删除', 'sys_role_delete', 'delete', '', '', NULL, 1, 1, 0, 0, '2021-11-14 21:05:03', '2021-11-14 21:06:37', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459870315957563393, 1443484962904367106, '配置角色权限', 'sys_role_config_per', 'config', '', '', NULL, 0, 1, 0, 0, '2021-11-14 21:06:21', '2021-11-14 21:06:21', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459870568081371137, 1449236520891928577, '查看', 'sys_post_view', 'view', '', '', NULL, 4, 1, 0, 0, '2021-11-14 21:07:21', '2021-11-14 21:07:21', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459870681822507009, 1449236520891928577, '添加', 'sys_post_add', 'add', '', '', NULL, 3, 1, 0, 0, '2021-11-14 21:07:48', '2021-11-14 21:07:48', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459870827058671617, 1449236520891928577, '编辑', 'sys_post_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2021-11-14 21:08:23', '2021-11-14 21:08:23', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459870934340579330, 1449236520891928577, '删除', 'sys_post_delete', 'delete', '', '', NULL, 1, 1, 0, 0, '2021-11-14 21:08:49', '2021-11-14 21:08:49', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1459871981415018497, 1437696509359235073, '修改用户密码', 'sys_user_modified_pwd', 'pwd', '', '', NULL, 0, 1, 0, 0, '2021-11-14 21:12:58', '2021-11-26 17:39:32', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491607184189464578, 0, '开发工具', 'sys_devtool_manage', 'menu', '/devtool', 'el-icon-s-cooperation', NULL, 0, 0, 0, 0, '2022-02-10 10:57:20', '2022-02-10 10:57:54', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491613197063987201, 1491607184189464578, '代码生成', 'gencode_manage', 'menu', '/devtool/gencode', 'el-icon-full-screen', NULL, 0, 0, 0, 0, '2022-02-10 11:21:14', '2022-02-10 11:23:13', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491671253374242817, 1491613197063987201, '创建工程', 'gencode_project_add', 'add', '', '', NULL, 0, 1, 0, 0, '2022-02-10 15:11:55', '2022-02-10 15:11:55', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491671712893800449, 1491613197063987201, '查看工程', 'gencode_project_view', 'view', '', '', NULL, 1, 1, 0, 0, '2022-02-10 15:13:45', '2022-02-10 15:13:45', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491671903210344450, 1491613197063987201, '编辑工程', 'gencode_project_edit', 'edit', '', '', NULL, 2, 1, 0, 0, '2022-02-10 15:14:30', '2022-02-10 15:14:30', 'EC888888', 'EC888888');
INSERT INTO `ec_system_menu` VALUES (1491672048777859074, 1491613197063987201, '删除工程', 'gencode_project_delete', 'delete', '', '', NULL, 0, 1, 0, 0, '2022-02-10 15:15:05', '2022-02-10 15:15:05', 'EC888888', 'EC888888');

-- ----------------------------
-- Table structure for ec_system_post
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_post`;
CREATE TABLE `ec_system_post` (
  `post_id` bigint(64) NOT NULL COMMENT '岗位ID',
  `tenant_id` bigint(64) NOT NULL COMMENT '所属租户ID',
  `post_name` varchar(50) NOT NULL COMMENT '岗位名称',
  `post_code` varchar(30) NOT NULL DEFAULT '' COMMENT '岗位编码',
  `post_sort` int(11) NOT NULL DEFAULT '0' COMMENT '岗位排序',
  `post_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '岗位描述',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`post_id`),
  UNIQUE KEY `tenant_id_post_code` (`tenant_id`,`post_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位表';

-- ----------------------------
-- Records of ec_system_post
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_post` VALUES (1450767760723918849, 1442414898631729154, '总经理', 'CEO', 20, '公司总经理', 0, '2021-10-20 18:16:03', '2021-12-05 16:39:08', 'EC888888', 'EC888888');
INSERT INTO `ec_system_post` VALUES (1464171813491286018, 1442414898631729154, '首席技术官', 'CTO', 4, '系统架构设计', 0, '2021-11-26 17:58:58', '2021-11-26 17:59:20', 'EC888888', 'EC888888');
COMMIT;

-- ----------------------------
-- Table structure for ec_system_role
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_role`;
CREATE TABLE `ec_system_role` (
  `role_id` bigint(64) unsigned NOT NULL COMMENT '角色id',
  `tenant_id` bigint(64) NOT NULL COMMENT '租户ID',
  `role_name` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名称',
  `role_code` varchar(50) NOT NULL COMMENT '角色编码',
  `role_desc` varchar(100) DEFAULT NULL COMMENT '角色描述',
  `role_sort` int(11) NOT NULL DEFAULT '0' COMMENT '角色排序',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`role_id`),
  UNIQUE KEY `tanant_id_role_code` (`tenant_id`,`role_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户角色表';

-- ----------------------------
-- Records of ec_system_role
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_role` VALUES (1464156988723798018, 1442414898631729154, '系统超级管理员', 'SUPER_ADMINISTRATOR', '系统超级管理员', 10000, 0, '2021-06-13 16:08:23', '2021-11-26 17:22:21', 'EC888888', 'EC888888');
INSERT INTO `ec_system_role` VALUES (1464171409403650049, 1442414898631729154, '管理员', 'ADMINISTRATOR', '系统管理员', 8888, 0, '2021-11-26 17:57:22', '2022-05-09 22:14:35', 'EC888888', 'EC888888');
COMMIT;

-- ----------------------------
-- Table structure for ec_system_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_role_menu`;
CREATE TABLE `ec_system_role_menu` (
  `role_menu_id` bigint(64) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `role_id` bigint(64) NOT NULL COMMENT '角色ID',
  `menu_id` bigint(64) NOT NULL COMMENT '菜单ID',
  PRIMARY KEY (`role_menu_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1523845649355272196 DEFAULT CHARSET=utf8 COMMENT='角色菜单关系表';


-- ----------------------------
-- Table structure for ec_system_role_user
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_role_user`;
CREATE TABLE `ec_system_role_user` (
  `role_user_id` bigint(64) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint(64) NOT NULL COMMENT '用户ID',
  `role_id` bigint(64) NOT NULL COMMENT '角色ID',
  PRIMARY KEY (`role_user_id`),
  KEY `user_id` (`user_id`),
  KEY `role_id` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1523846879716601858 DEFAULT CHARSET=utf8 COMMENT='系统角色用户关系表';

-- ----------------------------
-- Records of ec_system_role_user
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_role_user` VALUES (1464172420088307713, 1437695137926684674, 1464156988723798018);
INSERT INTO `ec_system_role_user` VALUES (1493188317364707330, 1464172420088307713, 1464171409403650049);
COMMIT;
ALTER TABLE `ec-cloud`.`ec_system_tenant`
    ADD COLUMN `tenant_type` varchar(64) NULL AFTER `tenant_id`;
-- ----------------------------
-- Table structure for ec_system_tenant
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_tenant`;
CREATE TABLE `ec_system_tenant` (
  `tenant_id` bigint(64) unsigned NOT NULL COMMENT '租户ID，所有的用户都会涉及到这个id',
  `tenant_type` varchar(64) NULL COMMENT '租户分类',
  `tenant_name` varchar(50) NOT NULL DEFAULT '' COMMENT '租户名称',
  `tenant_code` varchar(50) NOT NULL DEFAULT '' COMMENT '租户编码',
  `contacts` varchar(20) NOT NULL DEFAULT '' COMMENT '联系人',
  `contact_number` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  `tenant_desc` varchar(1000) DEFAULT '' COMMENT '租户描述',
  `address` varchar(500) NOT NULL DEFAULT '' COMMENT '地址',
  `lease_time_start` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '租赁开始时间',
  `lease_time_end` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '租赁结束时间',
  `account_prefix` varchar(5) DEFAULT NULL COMMENT '账号前缀限制两~四个大写字母',
  `tenant_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-正常，1-已禁用',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0:未删除，1-已删除',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`tenant_id`),
  UNIQUE KEY `tenant_code` (`tenant_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='租户表';

-- ----------------------------
-- Records of ec_system_tenant
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_tenant` VALUES (1442414898631729154, 'Ec-Cloud软件服务无限公司', 'EC_HEADQUARTERS', 'EricLee', '15811111111', 'Ec-Cloud致力服务于企业软件开发，提供各种互联网软件服务', '银河系', '2021-09-17 16:41:53', '2100-01-01 16:41:53', 'CS', 0, 0, '2021-06-13 16:11:43', '2022-05-08 13:28:07', 'EC888888', 'EC888888');
COMMIT;

-- ----------------------------
-- Table structure for ec_system_top_menu
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_top_menu`;
CREATE TABLE `ec_system_top_menu` (
  `top_menu_id` bigint(64) unsigned NOT NULL,
  `user_id` bigint(64) NOT NULL COMMENT '用户userID',
  `top_menu_name` varchar(50) NOT NULL DEFAULT '' COMMENT '顶部菜单名称',
  `path` varchar(100) NOT NULL DEFAULT '' COMMENT '外链url',
  `relation_menu_ids` text COMMENT '关联菜单ID',
  `icon` varchar(50) DEFAULT NULL COMMENT '菜单图标',
  `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-菜单，1-外链',
  `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
  `is_delete` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人工号',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人工号',
  PRIMARY KEY (`top_menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='顶部菜单表';

-- ----------------------------
-- Table structure for ec_system_tenant_param
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_tenant_param`;
CREATE TABLE `ec_system_tenant_param`  (
                                           `param_id` bigint(64) NOT NULL COMMENT '参数id',
                                           `param_code` varchar(128) CHARACTER SET gbk COLLATE gbk_chinese_ci NULL DEFAULT NULL COMMENT '参数代码',
                                           `param_name` varchar(128) CHARACTER SET gbk COLLATE gbk_chinese_ci NULL DEFAULT NULL COMMENT '参数名称',
                                           `param_value` varchar(512) CHARACTER SET gbk COLLATE gbk_chinese_ci NULL DEFAULT NULL COMMENT '参数值',
                                           `param_type` tinyint(3) NOT NULL COMMENT '参数类型',
                                           `remark` varchar(1024) CHARACTER SET gbk COLLATE gbk_chinese_ci NULL DEFAULT NULL COMMENT '备注',
                                           `tenant_id` bigint(64) NULL DEFAULT NULL COMMENT '租户ID',
                                           `is_delete` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0-未删除，1-已删除',
                                           `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
                                           `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
                                           `create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
                                           `update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
                                           PRIMARY KEY (`param_id`) USING BTREE,
                                           INDEX `idx_ec_system_param1`(`param_code`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = gbk COLLATE = gbk_chinese_ci COMMENT = '系统租户参数表' ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for ec_system_user
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_user`;
CREATE TABLE `ec_system_user` (
  `user_id` bigint(64) unsigned NOT NULL,
  `tenant_id` bigint(64) NOT NULL COMMENT '所属租户ID',
  `dept_id` bigint(64) NOT NULL COMMENT '所属部门ID',
  `post_id` bigint(64) DEFAULT NULL COMMENT '所属岗位ID',
  `user_account` varchar(50) NOT NULL COMMENT '用户账号',
  `user_password` varchar(255) CHARACTER SET utf8mb4 NOT NULL COMMENT '用户密码',
  `user_name` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '用户昵称',
  `user_real_name` varchar(50) NOT NULL DEFAULT '' COMMENT '用户真实姓名',
  `user_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '0-正常，1-已禁用',
  `user_avatar` varchar(2000) DEFAULT NULL COMMENT '用户头像',
  `user_sex` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用户性别：0-未知，1-男，2-女',
  `user_birthday` date DEFAULT NULL COMMENT '用户生日日期',
  `user_mobile` varchar(50) DEFAULT NULL COMMENT '用户手机号',
  `sys_data` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否系统数据: 0-不是，1-是',
  `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',
  `user_login_ip` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '登录IP地址',
  `last_login_time` datetime DEFAULT NULL COMMENT '最后一次登录时间',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `create_by` varchar(50) DEFAULT NULL COMMENT '创建人',
  `update_by` varchar(50) DEFAULT NULL COMMENT '更新人',
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_account_idex` (`user_account`),
  KEY `tenant_dept_post_idx` (`tenant_id`,`dept_id`,`post_id`),
  KEY `user_name_idex` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统管理用户表';

-- ----------------------------
-- Records of ec_system_user
-- ----------------------------
BEGIN;
INSERT INTO `ec_system_user` VALUES (1437695137926684674, 1442414898631729154, 1442414898812084225, 1450767760723918849, 'EC888888', '$2a$10$DBWeXht1re8FrTLpvwaV6OOElLjX3Ras64PUsZ59k278hedEXc3RS', 'superAdmin', 'ec', 0, 'https://iconfont.alicdn.com/t/9abd4acd-0b67-4b63-9163-205238a6aab4.png', 1, '1991-07-03', '15811111111', 1, 0, '127.0.0.1', '2022-05-10 20:53:22', '2021-06-13 16:15:34', '2022-05-10 20:53:22', 'EC888888', 'EC888888');
INSERT INTO `ec_system_user` VALUES (1464172420088307713, 1442414898631729154, 1442429609511301122, 1464171813491286018, 'EC000001', '$2a$10$H7zZVUPALel/2SFzAmoOgO0eaaVvViw2dTohwkoGvY.A0HHeSJT7S', 'admin', 'admin', 0, NULL, 1, '1991-07-03', '15811111111', 0, 0, '127.0.0.1', '2022-05-10 18:14:19', '2021-11-26 18:01:23', '2022-05-10 18:14:18', 'EC888888', 'EC888888');
COMMIT;

-- ----------------------------
-- Table structure for ec_system_dict_type
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_dict_type`;
CREATE TABLE `ec_system_dict_type`  (
    `dict_type_id` bigint(64) NOT NULL,
    `dict_type_name` varchar(255) NULL COMMENT '字典类型名称',
    `dict_type_code` varchar(255) NULL COMMENT '字典类型编码',
    `dict_type_desc` varchar(255) NULL COMMENT '字典类型描述',
    `is_system_dict` tinyint(3) NULL DEFAULT 0 COMMENT '是否系统字典，0：否（默认），1：是',
    `is_delete` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0-未删除，1-已删除',
    `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
    `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
    `create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
    `update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`dict_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统字典种类表';

ALTER TABLE `ec-cloud`.`ec_system_dict_type`
ADD UNIQUE INDEX `uni_SysDictCode`(`dict_type_code`);

-- ----------------------------
-- Table structure for ec_system_dict
-- ----------------------------
DROP TABLE IF EXISTS `ec_system_dict`;
CREATE TABLE `ec_system_dict`  (
    `dict_id` tinyint(64) NOT NULL COMMENT '字典明细ID',
    `dict_type_id` bigint(64) NOT NULL COMMENT '字典ID',
    `dict_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典明细名称',
    `dict_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典明细key',
    `dict_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典明细value',
    `dict_sort` int(32) NULL DEFAULT NULL COMMENT '字典明细排序',
    `dict_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
    `is_delete` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0-未删除，1-已删除',
    `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
    `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
    `create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
    `update_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
    PRIMARY KEY (`dict_id`),
    CONSTRAINT `FK_EcSysDict_dictTypeId` FOREIGN KEY (`dict_type_id`) REFERENCES `ec-cloud`.`ec_system_dict_type` (`dict_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统字典明细表';

SET FOREIGN_KEY_CHECKS = 1;
